package com.example.leonard.service.impl;

import com.alibaba.fastjson.JSON;
import com.example.leonard.core.domain.Employee;
import com.example.leonard.mapper.EmployeeMapper;
import com.example.leonard.service.IEmployeeService;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.slf4j.LoggerFactory;

import java.util.List;


@Service
public class EmployeeServiceImpl implements IEmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;
    private static final Logger LOGGER = LoggerFactory.getLogger(EmployeeServiceImpl.class);

    @Override
    public Employee selectById(Long id) {
        //添加注释
        Employee employee = employeeMapper.selectByPrimaryKey(id);
        LOGGER.info("员工的信息->{}", JSON.toJSONString(employee));
        return employee;
    }

    @Override
    public List<Employee> selectAll() {
        List<Employee> employees = employeeMapper.selectAll();
        return employees;
    }
}
